from pandac.PandaModules import CollisionSphere
from panda3d.core import CollisionNode
from panda3d.core import PandaNode,NodePath,Camera,TextNode
from direct.showbase.DirectObject import DirectObject
from itemRelated.abstractDrop import AbstractDrop

class BananaDrop(AbstractDrop):
    """ Class representing banana, which player can pick up and place in his/her
        inventory. Attribs are implemented from AbstractDrop
    """
    
    _itemName = 'Banana'
     
    _positionX = None
    
    _positionY = None
    
    _positionZ = None
    
    _itemQuantity = -500
    
    _itemType = 'Not yet implemented'
    
    _equip = False
    
    _model = None
    
    _modelFilePath = "models/banana"
    
    _collisionSolid = None
    
    def __init__(self, DirectObject, x, y, z, iItemQuantity=1):
        self._positionX = x
        self._positionY = y
        self._positionZ = z
        self._itemQuantity = iItemQuantity
        self._collisionSolid = CollisionSphere(0, 0, 0, 0.4)
        self._model = loader.loadModel(self._modelFilePath)
        self._model.reparentTo(render)
        self._model.setPos(x, y, z)
        collider = self._model.attachNewNode(
            CollisionNode('bananaCollisionNode')
        )
        
        collider.node().addSolid(self._collisionSolid)
#        collider.show()
        collider.setPythonTag("dropObject", self)
        